/**
 * Created by Juvid on 2017/3/24.
 */
//ES6
import React, {
    Component,
    PropTypes,
} from 'react';
import {
    View,
    Image,
    Text,
    Alert,
    TouchableHighlight
} from 'react-native'

//ES6
export default class MyComponent extends Component{
    constructor(props){//构造函数
        super(props);
        this.state = {
            loopsRemaining: this.props.maxLoops,
        };
    }
    static defaultProps = {
        autoPlay: false,
        maxLoops: 10,
        label:'哈哈哈',
    };  // 注意这里有分号
    static propTypes = {
        autoPlay: React.PropTypes.bool.isRequired,
        maxLoops: React.PropTypes.number.isRequired,
        posterFrameSrc: React.PropTypes.string.isRequired,
        videoSrc: React.PropTypes.string.isRequired,
    };  // 注意这里有分号

    handleOptionsButtonClick(e){

        this.setState({showOptionsModal: true});
    }
    handleClick(){
        Alert.alert("呵呵呵");
    }
    _onPressButton(e) {
        Alert.alert("呵呵呵");
    }
    render() {
        return (
            <View>
                <TouchableHighlight
                    onPress={this.handleOptionsButtonClick.bind(this)}
                    style={{height:50}}
                   /* onPress={e=>this.handleOptionsButtonClick(e)}*/
                >
                    <Text>{this.props.label}</Text>
                </TouchableHighlight>

                <TouchableHighlight
                    onPress={this._onPressButton}
                    style={{height:50}}
                >
                    <Text>{"呵呵呵"}</Text>
                </TouchableHighlight>
            </View>
        );
    } // 注意这里既没有分号也没有逗号




}